
export function format(num) {
    let reg = new RegExp('(-?\\d+)(\\.\\d+)?')
    if (!reg.test(num)) {
      return  num
    }
    let str = num.toString()
    if (str.indexOf(".") ==-1){
      return num
    }
    let array = str.split(".")
    let  s =  array[1];
    let l = s.length > 3 ? 3 : s.length
    return array[0] + "." + array[1].substr(0, l)
}
